#!/bin/bash
path=$3
downloadpath='/usr/local/caddy/www/aria2/Download'
if [ $2 -eq 0 ]
  then
    exit 0
fi
while true; do
filepath=$path
path=${path%/*};
if [ "$path" = "$downloadpath" ] && [ $2 -eq 1 ]
    then
      /usr/bin/php /root/git/sits/www/public/oneindex/one.php upload:file "$filepath" /upload/
      rm -rf "$filepath"
    exit 0
elif [ "$path" = "$downloadpath" ]
    then
      /usr/bin/php /root/git/sits/www/public/oneindex/one.php upload:folder "$filepath"/ /upload/"${filepath##*/}"/
      rm -rf "$filepath"/
    exit 0
fi
done
# /root/git/sits/www/bash/start.sh